import React from 'react';
import type {DescriptionsProps} from 'antd';
import {Descriptions, Empty} from 'antd';
import {useUserInfoStore} from "@/store/BaseStore.ts";

const App: React.FC = () => {
    const userInfo = useUserInfoStore(state => state.userInfo);

    if (userInfo == null) {
        return (
            <Empty/>
        )
    }

    const items: DescriptionsProps['items'] = [
        {
            key: '1',
            label: '用户id',
            children: userInfo.id,
        },
        {
            key: '2',
            label: '昵称',
            children: userInfo.nickName,
        },
        {
            key: '3',
            label: '用户头像',
            children: userInfo.avatar,
            span: 2
        },
        {
            key: '4',
            label: '账号',
            children: userInfo.account,
            span: 2
        },
        {
            key: '5',
            label: '用户类型',
            children: userInfo.userType,
        }
    ];

    return (
        <Descriptions title="个人信息"
                      bordered items={items}
        />
    )
};

export default App;